From: Florian Müllner Date: Thu, 7 Sep 2023 15:59:03 +0000 (+0200) Subject: screenshot: Do not wrongly enable window button X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~312^2^2~21 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=521525948eed85cc27c0796a0b9569d161df81ba;p=gnome-shell.git screenshot: Do not wrongly enable window button The window button is disabled when - there are no windows - we are in screen-recording mode - the session mode doesn't allow windows However the last condition is only taken into account when opening the dialog, but not when switching from recording- to screenshot mode. Address this by updating the button's sensitivity in a separate function, so the different conditions are considered consistently. Closes https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/6990 Part-of: --- diff --git a/js/ui/screenshot.js b/js/ui/screenshot.js index d3c28a26b..d63653396 100644 --- a/js/ui/screenshot.js +++ b/js/ui/screenshot.js @@ -1401,6 +1401,16 @@ export const ScreenshotUI = GObject.registerClass({ this._castButton.reactive = Main.sessionMode.allowScreencast; } + _syncWindowButtonSensitivity() { + const windows = + this._windowSelectors.flatMap(selector => selector.windows()); + + this._windowButton.reactive = + Main.sessionMode.hasWindows && + windows.length > 0 && + !this._castButton.checked; + } + _refreshButtonLayout() { const buttonLayout = Meta.prefs_get_button_layout(); @@ -1517,10 +1527,7 @@ export const ScreenshotUI = GObject.registerClass({ }); } - this._windowButton.reactive = - Main.sessionMode.hasWindows && - windows.length > 0 && - !this._castButton.checked; + this._syncWindowButtonSensitivity(); if (!this._windowButton.reactive) this._selectionButton.checked = true; @@ -1763,9 +1770,7 @@ export const ScreenshotUI = GObject.registerClass({ this._captureButton.remove_style_pseudo_class('cast'); - const windows = - this._windowSelectors.flatMap(selector => selector.windows()); - this._windowButton.reactive = windows.length > 0; + this._syncWindowButtonSensitivity(); } }